<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 获取到类型为h1的第1个 */
        h1:first-of-type{
            color: red;
        }
        /* 获取到类型为h1的最后一个 */
        h1:last-of-type{
            color: red;
        }
        /* 获取到类型为h1的第3个 */
        h1:nth-of-type(3){
            color: aquamarine;
        }
    </style>
</head>
<body>
    <div class="box">
        <p>11111111111</p>
        <h1>2222222222</h1>
        <p>33333333333</p>
        <h1>4444444444</h1>
        <p>55555555555</p>
        <h1>66666666666</h1>
        <p>777777777777</p>
        <h1>88888888888</h1>
    </div>
</body>
</html>